#include<fstream>
#include<iostream>
#include <sstream>
#include <string>

// (*) include lexical analyser header
#include <./depythonize_c_lex>

#include <./util.h>

//FIXME, this program should only call translate function
int main(int argc, char** argv){
  std::ostringstream osstream;

  quex::depythonize_c_lex qlex(argv[1]);

  std::vector<quex::Token> tokens_before_token;
  std::vector<quex::Token> tokens_before_tokenNext;

  quex::Token  token;
  quex::Token  tokenNext;

  //Loop. Starts in program mode
  get_token(token,qlex,tokens_before_token);
  get_token(tokenNext,qlex,tokens_before_tokenNext);
  
  while( token.type_id() != QUEX_TKN_TERMINATION ){
    program_mode     (osstream,qlex,token,tokenNext, tokens_before_token, tokens_before_tokenNext);
    preprocessor_mode(osstream,qlex,token,tokenNext, tokens_before_token, tokens_before_tokenNext);}
  
  //Write the non compilable tokens
  write_out(osstream,tokens_before_token);

  //Write it out
  std::cout << osstream.str();

  return 0;}

//--helper--
